var e = require("../../@babel/runtime/helpers/interopRequireDefault"), t = require("../../@babel/runtime/helpers/defineProperty"), a = e(require("../../@babel/runtime/regenerator")), r = require("../../@babel/runtime/helpers/asyncToGenerator"), i = e(require("../../http/order")), n = (e(require("../../miniprogram_npm/@vant/weapp/toast/toast")), 
getApp(), new i.default());

Page({
    data: {
        paramsData: {
            pageNum: 1,
            pageSize: 10
        },
        loading: !0,
        orderList: [],
        currPage: 0,
        totalPage: 1,
        isRefresh: !1
    },
    onLoad: function(e) {
        this.getPickList();
    },
    getPickList: function() {
        var e = this;
        return r(a.default.mark(function t() {
            var r, i, o;
            return a.default.wrap(function(t) {
                for (;;) switch (t.prev = t.next) {
                  case 0:
                    if (e.data.currPage != e.data.totalPage) {
                        t.next = 3;
                        break;
                    }
                    return wx.showToast({
                        title: "没有更多数据了",
                        icon: "none",
                        duration: 2e3
                    }), t.abrupt("return");

                  case 3:
                    return wx.showLoading({
                        mask: !0,
                        title: "加载中…"
                    }), e.setData({
                        loading: !0
                    }), t.next = 7, n.pickRecord(e.data.paramsData);

                  case 7:
                    r = t.sent, i = r.data.list, o = e.data.orderList.concat(i), e.setData({
                        orderList: o,
                        currPage: r.data.currPage,
                        totalPage: r.data.totalPage,
                        loading: !1,
                        isRefresh: !1
                    }), wx.hideLoading();

                  case 12:
                  case "end":
                    return t.stop();
                }
            }, t);
        }))();
    },
    toPick_details: function(e) {
        var t = e.currentTarget.dataset.mergeorderid;
        wx.navigateTo({
            url: "/pages/pick_details/pick_details?mergeOrderId=".concat(t)
        });
    },
    onReady: function() {},
    onShow: function() {
        console.log(this.data.isRefresh), this.data.isRefresh && (this.setData({
            paramsData: {
                pageNum: 1,
                pageSize: 10
            },
            orderList: [],
            currPage: 0,
            totalPage: 1
        }), this.getPickList());
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        setTimeout(function() {
            wx.stopPullDownRefresh();
        }, 500);
    },
    onReachBottom: function() {
        this.setData(t({}, "paramsData.pageNum", this.data.paramsData.pageNum += 1)), this.getPickList();
    }
});